//: Playground - noun: a place where people can play

import UIKit

//位运算符

//按位取反
let initialBits: UInt8 = 0b00001111
let invertedBits = ~initialBits
//按位与
let firstSixBits : UInt8 = 0b11111100
let lastSixBits : UInt8 = 0b00111111
let middleFourBits = firstSixBits & lastSixBits
//按位或
let combinedbits = firstSixBits | lastSixBits
struct Vector2D {
    var x = 0.0, y = 0.0
}

func + (left: Vector2D, right: Vector2D) -> Vector2D {
    return Vector2D(x: left.x + right.x, y: left.y + right.y)
}

let vertor1 = Vector2D(x: 4.0, y: 1.0)
let vertor2 = Vector2D(x: 2.0, y: 4.0)

let combinedVector = vertor1 + vertor2
print(combinedVector.x)
print(combinedVector.y)


